package com.ruoyi.common.utils.http;

import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.web.client.RestTemplate;

import java.time.Duration;


public class RestUtils {
    public static Long connectTimeout=5*1000L;
    public static Long readTimeout=300*1000L;


    public static RestTemplate getRestTemplate(){
        RestTemplate template =new RestTemplate();
        return template;
    }

    public static RestTemplate getRestTemplate(String username, String passwd){
        RestTemplate template =new RestTemplateBuilder()
                .setConnectTimeout(Duration.ofMillis(connectTimeout))
                .setReadTimeout(Duration.ofMillis(readTimeout))
                .basicAuthentication(username,passwd).build();
        return template;
    }
}
